<?php
class CollectWwwtianyacn extends CollectBase
{

    public static function getPageContent($url) {   
               
            //$url='http://www.phplover.cn';   
            import("@.ORG.Utility");   
            $pagehtml= Utility::DoGet($url);      
       
            $pagehtml = preg_replace("/　/",'',$pagehtml);   
            $pagehtml=iconv("GB2312","UTF-8//IGNORE",$pagehtml);
            //charset   
            if($pageinfo[charset] == '' ) {  
                preg_match('@<meta.+charset=([\w\-]+)[^>]*>@i',$pagehtml,$matches);  
                $pageinfo[charset] = trim($matches[1]);  
            }  
            //desctiption  
            preg_match('@<meta\s+name=\"*description\"*\s+content\s*=\s*([^/>]+)/*>@i',$pagehtml,$matches);  
 
            $desc = trim($matches[1]);  
            $pageinfo[description] = str_replace("\"", '',$desc);  
              
     
            preg_match('@<meta\s+name=\"*keywords\"*\s+content\s*=\s*([^/>]+)/*>@i',$pagehtml,$matches);  

            $keywords = trim($matches[1]);  
            $pageinfo[keywords] = str_replace("\"", '',$keywords);  
     
              
            preg_match("/<title>(.*)<\/title>/smUi",$pagehtml, $matches);  
            $pageinfo[title] = self::trims($matches[1]);  
            preg_match("/<body.*>(.*)<\/body>/smUi",$pagehtml, $matches);  


			$pagetitle = $pageinfo['title'];
			$pagetitle = explode('_', $pagetitle);
		    $pageinfo['plate'] = self::trims($pagetitle[1]);
			$pageinfo['title'] = self::trims($pagetitle[0]);
			
			preg_match("/<div class=\"authi xg1\">(.*)<\/div>/smUi",$pagehtml, $matches); 
			$authi = $matches[1];
			preg_match("/访问数?：([0-9]*?)/Uisx",$pagehtml, $matches); 
			$pageinfo['views'] = $matches[1];
			
			preg_match("/回复数?：([0-9]*?)/Uisx",$pagehtml, $matches);
			$pageinfo['replies'] = $matches[1];
			
			preg_match("/发表日期：([^<>]*)<\/div>/smUi",$pagehtml, $matches);
		    $pageinfo['dateline'] = $matches[1];
		    

			preg_match("/var\s*firstAuthor\s*=\s*\"([^<>]*)\";/i",$pagehtml, $matches);

		    $pageinfo['author'] = $matches[1];
			
			
			preg_match("/<div\s*class=\"item\">\s*<div\s*class=\"vcard\"><span\s*class=\"floor\">楼主<\/span>.*<\/div>\s*<div\s*class=\"post\"\s*_app=\"eleshare\">(.*)<div\s*class=\"post\-jb\">\s*<input\s*type=\"hidden\"\s*value=\"[0-9]+\"\s*\/>\s*<\/div>/Uisx",$pagehtml, $matches2);
			
			$pageinfo['message'] = addslashes( self::replaceHtmlAndJs2($matches2[1])); 
			//print_r($pageinfo);
            return $pageinfo;  
     
    }  
 	
}
?>